<?php
namespace app\admin\logic;

//分类页
use think\facade\Request;

class GcategoryLogic{
    //cate 分类列表没有下一级是不可点
    public static function cateData($cate){
        //查出全部的父id
        $parentAllid=\app\admin\model\Gcategory::cateNext();
        foreach ($cate as &$v){
            //判断分类id是否在父id中存在
            if (in_array($v['cate_id'],$parentAllid)){
                $v['cate_next']=1;
            }
        }
        return $cate;
    }
    //cate分类列表的where
    public static function cateWhere(){
        $where=[];
        $param=Request::param();
        $parent_id=isset($param['parent_id'])?$param['parent_id']:0;
        $where[]=['parent_id','=',$parent_id];
        return $where;

    }


}